
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/tutor/template/main.xhtml">

	<ui:define name="body">
		<h:form>
			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{acompanhamentoListMB.getNextView}"
						actionListener="#{acompanhamentoListMB.clear}" ajax="false" />

					<p:commandButton title="#{messages['button.delete']}" icon="ui-icon-trash" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<h:outputLabel value="#{messages['acompanhamento.label.filtro']}: "
						for="filtro" styleClass="text-input" />
					<h:inputText id="nome" value="#{acompanhamentoListMB.filtro}"
						title="#{messages['acompanhamento.alt.filtro']}" />

					<h:outputLabel value="#{messages['acompanhamento.label.tipofitro']}: " for="tipoFiltro"
						styleClass="text-input" />						
					<h:selectOneMenu id="tipoFiltro" value="#{acompanhamentoListMB.tipoFiltro}"
						title="#{messages['acompanhamento.alt.tipofiltro']}">
			            <f:selectItem itemLabel="Todos" itemValue="todos" />
			            <f:selectItem itemLabel="Aluno" itemValue="aluno" />
			            <f:selectItem itemLabel="Turma" itemValue="turma" />
					</h:selectOneMenu>

					<p:commandButton title="#{messages['button.search']}"
						icon="ui-icon-search" actionListener="#{acompanhamentoListMB.list()}"
						ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{acompanhamentoListMB.deleteSelection}"
							actionListener="#{acompanhamentoListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>
			<p:dataTable id="list" var="bean" value="#{acompanhamentoListMB.resultList}">
				<f:facet name="header">#{messages['acompanhamento.list.table.title']}</f:facet>
				<p:column style="width:1%;">
					<h:selectBooleanCheckbox value="#{acompanhamentoListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
				</p:column>
				
				<p:column style="width:5%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['acompanhamento.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>
				
				<p:column sortBy="#{bean.turma}">
					<f:facet name="header">#{messages['acompanhamento.label.turma']}</f:facet>
					<h:commandLink action="#{acompanhamentoListMB.getNextView}" actionListener="#{acompanhamentoListMB.clear}">
						<h:outputText value="#{bean.turma.codigo}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.aluno}">
					<f:facet name="header">#{messages['acompanhamento.label.aluno']}</f:facet>
					<h:commandLink action="#{acompanhamentoListMB.getNextView}" actionListener="#{acompanhamentoListMB.clear}">
						<h:outputText value="#{bean.aluno.usuario.nome}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				
				<p:column sortBy="#{bean.ocorrencia}">
					<f:facet name="header">#{messages['acompanhamento.label.ocorrencia']}</f:facet>
					<h:commandLink action="#{acompanhamentoListMB.getNextView}" actionListener="#{acompanhamentoListMB.clear}">
						<h:outputText value="#{bean.ocorrencia}">
							<f:convertDateTime type="date" pattern="dd/MM/yyyy"/>
						</h:outputText>
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
			</p:dataTable>
		</h:form>

	</ui:define>
</ui:composition>